/*----------------------------------------------------------------------------
  Owner(s): Shane Whitfield
$Copyright: $
       $Id: $

 Purpose  : 
----------------------------------------------------------------------------*/
#pragma once

#include <stddef.h>
#include <assert.h>
#include <string.h>

/*--------------------------------------------------------------------------*/
// Array helpers
#define	DIM(a) ((int)(sizeof(a) / sizeof((a)[0])))


/*--------------------------------------------------------------------------*/
// General
#define UNUSED_PARAM(...) ((void)(__VA_ARGS__))
#if DEBUG
#define DEBUG_USED_PARAM(...)
#else
#define DEBUG_USED_PARAM(...) ((void)(__VA_ARGS__))
#endif

/*--------------------------------------------------------------------------*/
// Enum helpers

// Macro that adds basic enums types (Invalid, count, being, end, ..)
#define BEGIN_ENUM(inPrefix)							\
	inPrefix##Invalid = -1,								\
	inPrefix##BeforeBegin = -1
#define END_ENUM(inPrefix)								\
	inPrefix##End,										\
	inPrefix##Last  = inPrefix##End - 1,				\
	inPrefix##Begin = inPrefix##BeforeBegin + 1,		\
	inPrefix##Count = inPrefix##End - inPrefix##Begin

// Macro to allow bit operators
#define MAKE_ENUM_BIT_OPERATORS(inEnumType)                   	\
	inline inEnumType operator | (inEnumType a, inEnumType b)     	\
		{  return (inEnumType)((int)a | (int)b); }                	\
	inline inEnumType operator & (inEnumType a, inEnumType b)     	\
		{  return (inEnumType)((int)a & (int)b); }					\
	inline inEnumType operator ^ (inEnumType a, inEnumType b)		\
		{  return (inEnumType)((int)a ^ (int)b); }                  \
	inline inEnumType operator ~ (inEnumType a)						\
		{  return (inEnumType)~(int)a; }							\
	inline inEnumType operator |= (inEnumType& a, inEnumType b)		\
		{  return a = a | b; }                                      \
	inline inEnumType operator &= (inEnumType& a, inEnumType b)		\
		{  return a = a & b; }

// Macro to allow +/- operators
#define MAKE_ENUM_MATH_OPERATORS(inEnumType)										\
	inline inEnumType operator ++ (inEnumType& a)									\
		{  return a = (inEnumType)(a + 1);  }                                       \
	inline inEnumType operator ++ (inEnumType& a, int)								\
		{  inEnumType old = a;  ++a;  return old;  }                                \
	inline inEnumType operator -- (inEnumType& a)									\
		{  return a = (inEnumType)(a - 1);  }                                       \
	inline inEnumType operator -- (inEnumType& a, int)								\
		{  inEnumType old = a;  --a;  return old;  }                                \
	inline inEnumType operator + (inEnumType a, inEnumType b)						\
		{  return (inEnumType)((int)a + (int)b); }                                  \
	inline inEnumType operator - (inEnumType a, inEnumType b)						\
		{  return (inEnumType)((int)a - (int)b); }                                  \
	inline inEnumType operator += (inEnumType& a, inEnumType b)						\
		{  return a = (inEnumType)(a + b); }                                        \
	inline inEnumType operator -= (inEnumType& a, inEnumType b)						\
		{  return a = (inEnumType)(a - b); }										\
	inline inEnumType operator + (inEnumType a, int b)								\
		{  return (inEnumType)((int)a + b); }										\
	inline inEnumType operator - (inEnumType a, int b)								\
		{  return (inEnumType)((int)a - b); }										\
	inline inEnumType operator += (inEnumType& a, int b)							\
		{  return a = (inEnumType)((int)a + b); }									\
	inline inEnumType operator -= (inEnumType& a, int b)							\
		{  return a = (inEnumType)((int)a - b); }									\
	inline inEnumType operator + (int a, inEnumType b)								\
		{  return (inEnumType)(a + (int)b); }										\
	inline inEnumType operator - (int a, inEnumType b)								\
		{  return (inEnumType)(a - (int)b); }										\
	inline int operator += (int& a, inEnumType b)									\
		{  return a = a + (int)b; }													\
	inline int operator -= (int& a, inEnumType b)									\
		{  return a = a - (int)b; }


/*-----------------------------------EOF!-----------------------------------*/ 
